package com.hp.easyBuy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hp.easyBuy.dao.NewDao;
import com.hp.easyBuy.entity.TGoods;
import com.hp.easyBuy.entity.TNews;
import com.hp.easyBuy.service.NewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class NewServiceImpl extends ServiceImpl<NewDao, TNews> implements NewService {

    @Resource
    private NewDao newDao;

    @Override
    public Page<TNews> indexNewList(Integer NEWSTYPE) {
        Page page = new Page<>(1,7);
        QueryWrapper<TNews> queryWrapper = new QueryWrapper<TNews>();
        //是新闻还是公告
        queryWrapper.eq("NEWSTYPE", NEWSTYPE);
        //保证是上架的内容才会在上面
        queryWrapper.orderByDesc("NEWSID");
        Page pageList = newDao.selectMapsPage(page, queryWrapper);
        return pageList;
    }
}
